home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-05
/
21ripl.zip
/
RPLMIG21.CMD
< prev
Wrap
OS/2 REXX Batch file
|
1993-03-15
|
34KB
|
931 lines
/* RPLMIG21.CMD - REXX program to upgrade LAN Server to support RIPL of */
/* OS/2 2.1. The following upgrades are preformed: */
/* */
/* - Install new RIPL support files */
/* - Create os221*.cnf files */
/* - Create server records for os221*.cnf files in RPL.MAP */
/* */
/* Copyright: (C) Copyright IBM Corp. 1993 */
/* */
/* Note 1: All NLS message strings are centrally located in the */
/* subroutine Initialize_NLS_Messages at the end of this */
/* rexx procedure. */
CRLF = '0A0D'X
nulsufix = ' 1>nul 2>nul'
ERROR_INFO_type = 1
SYNTAX_type = 2
SourcePath = 'A:\'
Logfile = ''
/* initialize NLS error and informational message strings */
Call Initialize_NLS_Messages ERROR_INFO_type
/* handle command line parameters */
Parse Arg clp.1 clp.2 clp.3 .
Call Process_Input_Parameters clp.1, clp.2, clp.3
If result <> 0 Then Call Error_Exit
/* if logfile specified, delete old log file (if it exists) & log header */
If Logfile <> '' Then Do
Call Delete_File Logfile
msgdata = 'RPLMIG21 ' || message.2 || Date('U') Time()
Call Lineout Logfile, msgdata
If result <> 0 Then Do
Say errprefix || message.3 || Logfile
exit 4
end
Call Lineout Logfile, ' '
end
Call Determine_Boot_Drive
If result <> 0 Then Call Error_Exit
Call Determine_RIPL_Directory
If result <> 0 Then Call Error_Exit
Call Determine_LAN_Server_Version
If result <> 0 Then Call Error_Exit
/* check to see if 2.1 migration needs to be run. */
If File_Exist(rpldir'\RPLMIG21.$$$') = 0 Then Do
/* create new subdirectories */
Call Create_New_Directories
/* copy new/changed RIPL files */
Call Copy_RIPL_Files
If result <> 0 Then Call Error_Exit
/* update server name references in new DEFALT21.FIT */
Call Update_DEFALT21_FIT
If result <> 0 Then Do
Call Display_Log_Msg errprefix || message.8, ''
Call Error_Exit
end
else Call Display_Log_Msg message.17, ''
/* update the RPL.MAP file to add server records for 2.1 and verify */
/* field 12 of workstation record is valid */
Call Update_RPL_MAP
Call Display_Log_Msg message.15, ''
/* create the os221*.cnf files */
Call Create_os221_cnf_files
Call Display_Log_Msg message.16, ''
/* update master CONFIGRI.20 files */
Call Update_Master_Configri_20
Call Display_Log_Msg message.21, ''
/* create special migration file to indicate that migration is complete */
/* migration file is marked READ-ONLY */
rplm21 = rpldir'\RPLMIG21.$$$'
Call lineout rplm21, message.15
Call lineout rplm21, message.16
Call lineout rplm21
'@attrib +r 'rplm21 '1>nul'
end
If Logfile <> '' Then Do
Call Lineout Logfile
end
exit 0
/* start of subroutines */
/* This subroutine handles the error exit cleanup. */
Error_Exit:
If Logfile <> '' Then Do
Call Lineout Logfile
end
exit 4
/* subroutine to test for existance of a file */
File_Exist:
Arg testfilename
If lines(testfilename) = 1 Then rc = 1
else rc = 0
/* lines() leaves file open, must force close */
Call stream testfilename,C,'close'
return rc
/* subroutine to delete a file */
Delete_File:
arg delfilename
If lines(delfilename) <> 0 Then Do
Call stream delfilename,C,'close'
cmdline = '@DEL 'delfilename
address CMD cmdline
end
else Call stream delfilename,C,'close' /* must do an explicit close to prevent */
/* a zero length file from being created */
return 0
Display_Log_Msg:
Parse Arg msgstring, parm.1, parm.2, parm.3, parm.4, parm.5, parm.6
if parm.1 <> '' Then Do
/* substitution data supplied */
startpoint = 1
newmsg = ''
sdpos = pos('%', msgstring, startpoint)
Do while sdpos <> 0
j = substr(msgstring, sdpos+1, 1)
newmsg = newmsg || substr(msgstring, startpoint, sdpos-startpoint) || parm.j
startpoint = sdpos+2
sdpos = pos('%', msgstring, startpoint)
end
newmsg = newmsg || substr(msgstring, startpoint)
msgstring = newmsg
end
If Logfile = '' Then Do
/* display message locally */
Say msgstring
end
else Do
/* log message */
Call lineout Logfile, msgstring
end
return 0
Determine_Installed_OS2_Levels:
syslevel = '\OS2\INSTALL\SYSLEVEL.OS2'
If File_Exist(rpldir'\OS2'syslevel) = 1 Then os213 = 1
else os213 = 0
If File_Exist(rpldir'\OS2.20'syslevel) = 1 Then os220 = 1
else os220 = 0
If File_Exist(rpldir'\OS2.20a'syslevel) = 1 Then os220a = 1
else os220a = 0
If File_Exist(rpldir'\OS2.21'syslevel) = 1 Then os221 = 1
else os221 = 0
return
/* This subroutine determines the version of LAN Server installed on */
/* the Remote IPL server. */
Determine_LAN_Server_Version:
/* Read the first 60 bytes of SYSLEVEL.SRV and check the current server */
/* level. */
filename = lanpath'\SYSLEVEL.SRV'
syslevel = ''
Do i = 1 to 60
syslevel = syslevel || charin(filename)
end
Call Charout filename
/* get current csdlevel */
verp = pos('IP', syslevel)
csdlevel = substr(syslevel, verp, 8)
If verp <> 0 Then Do
/* recognize any level of LS 2.0 but only recognize initial release */
/* of LS 3.0 */
If substr(csdlevel, 4, 1) = '6' Then LS_version = 2
else If substr(csdlevel, 4, 1) = '7' Then Do
If substr(csdlevel, 5, 3) = '000' Then LS_version = 3
else LS_version = '3x'
end
else LS_version = ''
end
If LS_version = '' Then Do
/* not LS 2.0 or LS 3.x */
msgdata = errprefix || message.11
Call Display_Log_Msg msgdata, csdlevel
return 4
end
else If LS_version = '3x' Then Do
/* not initial LS 3.0 release */
msgdata = errprefix || message.12
Call Display_Log_Msg msgdata, csdlevel
return 4
end
return 0
/* create new subdirectories */
Create_New_Directories:
Call Display_Log_Msg message.20, ''
/* create MACHINES\DEFALT21 tree */
'@MD 'rpldir'\MACHINES\DEFALT21'nulsufix
'@MD 'rpldir'\MACHINES\DEFALT21\IBMLAN'nulsufix
/* create \IBMLAN\RPLUSER\DEFALT21 tree */
rupath = lanpath'\RPLUSER\DEFALT21'
'@MD 'rupath nulsufix
'@MD 'rupath'\IBMLAN'nulsufix
'@MD 'rupath'\IBMLAN\LOGS'nulsufix
'@MD 'rupath'\IBMLAN\PROFILES'nulsufix
'@MD 'rupath'\IBMLAN\ACCOUNTS'nulsufix
'@MD 'rupath'\IBMCOM'nulsufix
'@MD 'rupath'\SPOOL'nulsufix
'@MD 'rupath'\OS2'nulsufix
'@MD 'rupath'\OS2\MDOS'nulsufix
'@MD 'rupath'\OS2\MDOS\WINOS2'nulsufix
'@MD 'rupath'\OS2\SYSTEM'nulsufix
return 0
/* copy new/updated RIPL files to server */
Copy_RIPL_Files:
/* copy requester IBMLAN.INI to DEFALT21 tree */
srcfile = rpldir'\MACHINES\DEFALT20\IBMLAN\IBMLAN.INI'
trg = rpldir'\MACHINES\DEFALT21\IBMLAN\'
Call Display_Log_Msg message.18, srcfile, trg
'@COPY 'srcfile trg nulsufix
If rc = 0 Then Do
/* copy NET.ACC from DEFALT20 to DEFALT21 */
srcfile = lanpath'\RPLUSER\DEFALT20\IBMLAN\ACCOUNTS\NET.ACC'
trg = lanpath'\RPLUSER\DEFALT21\IBMLAN\ACCOUNTS\'
Call Display_Log_Msg message.18, srcfile, trg
'@COPY 'srcfile trg nulsufix
If rc = 0 Then Do
/* copy AUTOEXEC.20 from DEFALT20 TO DEFALT21 */
srcfile = lanpath'\RPLUSER\DEFALT20\AUTOEXEC.20'
trg = lanpath'\RPLUSER\DEFALT21\'
Call Display_Log_Msg message.18, srcfile, trg
'@COPY 'srcfile trg nulsufix
end
end
If rc <> 0 Then Do
Call Display_Log_Msg errprefix || message.9, srcfile, trg
return 4
end
/* if necessary, make backup copies of original .EXE files */
trg = lanpath'\NETPROG\RMM1.EX_'
if File_Exist(trg) = 0 Then Do
/* assume no backups exists, create them */
srcfile = lanpath'\NETPROG\RMM1.EXE'
Call Display_Log_Msg message.18, srcfile, trg
'@COPY 'srcfile trg nulsufix
srcfile = lanpath'\NETPROG\GETRPL.EXE'
trg = lanpath'\NETPROG\GETRPL.EX_'
Call Display_Log_Msg message.18, srcfile, trg
'@COPY 'srcfile trg nulsufix
end
/* rename old RPLSETD.CMD, if it exists */
If File_Exist(rpldir'\RPLSETD.CMD') = 1 Then Do
/* rename old version of RPLSETD.CMD in RPL directory */
'@RENAME 'rpldir'\RPLSETD.CMD RPLSETD.OLD'nulsufix
end
/* unzip common files to \IBMLAN\NETPROG */
trg = lanpath'\NETPROG\'
srcfile = SourcePath'IBMLS.ZIP'
Call Display_Log_Msg message.19, srcfile || '\*.*', trg
'@'lanpath'\INSTALL\PKUNZIP2 -o 'srcfile trg nulsufix
If rc <> 0 Then Do
Call Display_Log_Msg errprefix || message.10, srcfile, trg
return 4
end
/* unzip version EXE files, build source path based on version */
srcfile = SourcePath'IBMLS'
If LS_version = 2 Then srcfile = srcfile || '20.ZIP'
else srcfile = srcfile ||'30.ZIP'
/* if necessary, backup old file */
srcfile2 = lanpath'\NETPROG\RMM1.EXE'
trg2 = lanpath'\NETPROG\RMM1.EX_'
If File_Exist(trg2) = 0 Then '@COPY 'srcfile2 trg2 nulsufix
/* if necessary, backup old file */
srcfile2 = lanpath'\NETPROG\GETRPL.EXE'
trg2 = lanpath'\NETPROG\GETRPL.EX_'
If File_Exist(trg2) = 0 Then '@COPY 'srcfile2 trg2 nulsufix
/* RPLUPINI.EXE, if necessary, backup old file */
srcfile2 = lanpath'\NETPROG\RPLUPINI.EXE'
trg2 = lanpath'\NETPROG\RPLUPINI.EX_'
If File_Exist(trg2) = 0 Then '@COPY 'srcfile2 trg2 nulsufix
/* unzip *.EXE files */
trg = lanpath'\NETPROG\'
Call Display_Log_Msg message.19, srcfile || '\*.EXE', trg
'@'lanpath'\INSTALL\PKUNZIP2 -o 'srcfile trg '*.EXE' nulsufix
If rc <> 0 Then Do
Call Display_Log_Msg errprefix || message.10, srcfile || '\*.EXE', trg
return 4
end
/* process version unique files */
If LS_version = 2 Then Do
/* LAN Server version is 2.0 */
srcfile = SourcePath'IBMLS20.ZIP'
If substr(csdlevel, 4, 4) = '6000' Then Do
/* NETWKSTA.200 and MFSD20.SYS must be replace for level 6000 */
/* NETWKSTA.200, if necessary, backup old file */
srcfile2 = lanpath'\NETPROG\NETWKSTA.200'
trg2 = lanpath'\NETPROG\NETWKSTA.20_'
If File_Exist(trg2) = 0 Then '@COPY 'srcfile2 trg2 nulsufix
/* unzip NETWKSTA.200 */
trg = lanpath'\NETPROG\'
Call Display_Log_Msg message.19, srcfile || '\NETWKSTA.200', trg
'@'lanpath'\INSTALL\PKUNZIP2 -o 'srcfile trg 'NETWKSTA.200'nulsufix
If rc <> 0 Then Do
Call Display_Log_Msg errprefix || message.10, srcfile || '\NETWKSTA.200', trg
return 4
end
/* copy to RPL tree */
srcfile2 = rpldir'\IBMLAN\NETPROG\NETWKSTA.200'
trg2 = rpldir'\IBMLAN\NETPROG\NETWKSTA.20_'
If File_Exist(trg2) = 0 Then '@COPY 'srcfile2 trg2 nulsufix
srcfile2 = lanpath'\NETPROG\NETWKSTA.200'
trg2 = rpldir'\IBMLAN\NETPROG\'
Call Display_Log_Msg message.18, srcfile2, trg2
'@COPY 'srcfile2 trg2 nulsufix
/* MFSD20.SYS, if necessary, backup old file */
srcfile2 = rpldir'\OS2\MFSD20.SYS'
trg2 = rpldir'\OS2\MFSD20.SY_'
If File_Exist(trg2) = 0 Then '@COPY 'srcfile2 trg2 nulsufix
/* unzip MFSD20.SYS, note different directory from LS 3.0 */
trg = rpldir'\OS2\'
Call Display_Log_Msg message.19, srcfile || '\MFSD20.SYS', trg
'@'lanpath'\INSTALL\PKUNZIP2 -o 'srcfile trg 'MFSD20.SYS'nulsufix
If rc <> 0 Then Do
Call Display_Log_Msg errprefix || message.10, srcfile || '\MFSD20.SYS', trg
return 4
end
end
end
else Do
/* LAN Server version is 3.0 */
srcfile = SourcePath'IBMLS30.ZIP'
/* MFSD20.SYS, if necessary, backup old file */
srcfile2 = rpldir'\DOS\MFSD20.SYS'
trg2 = rpldir'\DOS\MFSD20.SY_'
If File_Exist(trg2) = 0 Then '@COPY 'srcfile2 trg2 nulsufix
/* unzip MFSD20.SYS, note different directory from LS 2.0 */
trg = rpldir'\DOS\'
Call Display_Log_Msg message.19, srcfile || '\MFSD20.SYS', trg
'@'lanpath'\INSTALL\PKUNZIP2 -o 'srcfile trg 'MFSD20.SYS'nulsufix
If rc <> 0 Then Do
Call Display_Log_Msg errprefix || message.10, srcfile, trg
return 4
end
/* copy new DEFALT21.FIT */
trg = rpldir'\FITS\'
Call Display_Log_Msg message.19, srcfile || '\DEFALT21.FIT', trg
'@'lanpath'\INSTALL\PKUNZIP2 -o 'srcfile trg 'DEFALT21.FIT'nulsufix
If rc <> 0 Then Do
Call Display_Log_Msg errprefix || message.10, srcfile || '\DEFALT21.FIT', trg
return 4
end
/* PROGMAN.INI, if necessary, backup old file */
fpath = rpldir'\OS2.21\OS2\MDOS\WINOS2\'
srcfile2 = fpath || 'PROGMAN.INI'
trg2 = fpath || 'PROGMAN.IN_'
If File_Exist(trg2) = 0 Then '@COPY 'srcfile2 trg2 nulsufix
/* SYSTEM.INI, if necessary, backup old file */
srcfile2 = fpath || 'SYSTEM.INI'
trg2 = fpath || 'SYSTEM.IN_'
If File_Exist(trg2) = 0 Then '@COPY 'srcfile2 trg2 nulsufix
/* copy new WINOS2 support files */
trg = fpath
Call Display_Log_Msg message.19, srcfile || '\*.INI', trg
'@'lanpath'\INSTALL\PKUNZIP2 -o 'srcfile trg '*.INI' nulsufix
If rc <> 0 Then Do
Call Display_Log_Msg errprefix || message.10, srcfile || '\*.INI', trg
return 4
end
end
/* copy *.INI and *.GRP files to DEFALT21 tree */
fpath = rpldir'\OS2.21\OS2\MDOS\WINOS2\'
srcfile2 = trg || '*.INI'
trg2 = lanpath'\RPLUSER\DEFALT21\OS2\MDOS\WINOS2\'
Call Display_Log_Msg message.18, srcfile2, trg2
'@XCOPY 'srcfile2 trg2 nulsufix
srcfile2 = trg || '*.GRP'
Call Display_Log_Msg message.18, srcfile2, trg2
'@XCOPY 'srcfile2 trg2 nulsufix
/* TEMPORARY WORKAROUND, remove when OS/2 2.1 supports this */
/* copy 16 bit version of MAKEINI.EXE and 32 bit version of CNVTINI.EXE */
srcfile = SourcePath'OS2.ZIP'
trg = rpldir'\OS2.21\OS2\'
Call Display_Log_Msg message.19, srcfile || '\*.*', trg
'@'lanpath'\INSTALL\PKUNZIP2 -o 'srcfile trg nulsufix
If rc <> 0 Then Do
Call Display_Log_Msg errprefix || message.10, srcfile, trg
return 4
end
return 0
/* subroutine updates all the server name references in the DEFALT21.FIT */
Update_DEFALT21_FIT:
/* get server name from first record in DEFALT20.FIT */
fit20 = rpldir'\FITS\DEFALT20.FIT'
data = linein(fit20)
Call stream fit20,C,'close'
spos = pos('\', data, 3)
If spos <> 0 Then servername = substr(data, 3, spos-3)
else Do
/* error */
Call Display_Log_Msg errprefix || message.7, ''
return 4
end
/* read each DEFALT21.FIT record and update server name references */
fit21 = rpldir'\FITS\DEFALT21.FIT'
tmpfit21 = rpldir'\FITS\DEFALT21.TMP'
do until lines(fit21) = 0
data = linein(fit21)
ucdata = translate(data)
serverp = pos('\\SERVER\', ucdata)
if serverp <> 0 Then Do
/* replace with real server name */
newdata = substr(data, 1, serverp+1)||servername||,
substr(data, serverp+8)
data = newdata
end
Call lineout tmpfit21, data
end
Call lineout tmpfit21
Call lineout fit21
'@RENAME 'fit21 ' DEFALT21.BAK'nulsufix
'@RENAME 'tmpfit21 ' DEFALT21.FIT'nulsufix
Call Delete_File rpldir'\FITS\DEFALT21.BAK'
return 0
/* This subroutine updates RPL.MAP to support OS/2 2.1 server records */
Update_RPL_MAP:
Call Determine_Installed_OS2_Levels
rplmap = rpldir'\RPL.MAP'
rplmaptmp = rpldir'\RPLMAP.TMP'
Call Delete_File rplmaptmp
i = 1
os221flag = 0
srvrec.0 = 0
do until lines(rplmap) = 0
data = linein(rplmap)
ucdata = translate(data)
psrv = pos('YYYYYYYYYYYY', ucdata)
if psrv <> 0 & psrv < 3 Then Do
/* server record, check for OS/2 type */
pos2 = pos('OS2BB', ucdata)
if pos2 <> 0 Then Do
/* OS/2 1.3, determine if it should be enabled or disabled */
If os213 = 1 Then Do
/* should be enabled */
If substr(data, 1, 1) = ';' Then data = substr(data, 2)
end
else Do
/* should be disabled */
If substr(data, 1, 1) <> ';' Then data = ';'data
end
end
else Do
pos2 = pos('OS220', ucdata)
if pos2 <> 0 Then Do
/* OS/2 2.0 type, save it */
srvrec.0 = i
srvrec.i = data
i = i + 1
/* determine if it should be enabled or disabled */
If os220 = 1 Then Do
/* should be enabled */
If substr(data, 1, 1) = ';' Then data = substr(data, 2)
end
else Do
/* should be disabled */
If substr(data, 1, 1) <> ';' Then data = ';'data
end
end
else Do
/* check for OS2.20a record */
pos2 = pos('OS22A', ucdata)
If pos2 <> 0 Then Do
/* os2.20a, determine if it should be enabled or disabled */
If os220a = 1 Then Do
/* should be enabled */
If substr(data, 1, 1) = ';' Then data = substr(data, 2)
end
else Do
/* should be disabled */
If substr(data, 1, 1) <> ';' Then data = ';'data
end
end
else Do
/* check for existing 2.1 server record */
pos2 = pos('OS221', ucdata)
If pos2 <> 0 Then os221flag = 1
else Do
/* check for last server record */
pos2 = pos('PCINIT.CNF', ucdata)
If pos2 <> 0 Then Do
/* end of server records, do we need to create new records? */
If os221flag = 0 Then Do
If srvrec.0 <> 0 Then Do
/* need to create OS/2 2.1 records, use saved */
/* OS220 records as a master */
Do j = 1 to srvrec.0
/* locate OS/2 cnf entry in field 2 */
pos2 = pos('OS220', translate(srvrec.j))
newdata = substr(srvrec.j, 1, pos2+3) || '1'
startpoint = pos2+5
/* locate OS type in field 7 */
pos2 = pos('~2.0~', srvrec.j, startpoint)
If pos2 <> 0 Then Do
/* LS 3.0 record format */
newdata = newdata ||,
substr(srvrec.j, startpoint, (pos2+3)-startpoint)
newdata = newdata || '1'
startpoint = pos2 + 4
end
else Do
pos2 = pos('~20~', srvrec.j, startpoint)
If pos2 <> 0 Then Do
/* LS 2.0 record format */
newdata = newdata ||,
substr(srvrec.j, startpoint, (pos2+3)-startpoint)
newdata = newdata || '1'
startpoint = pos2 + 3
end
else Do
/* type not recognized, doing nothing */
/* will cause existing description */
/* (field 7) to be used. */
end
end
/* locate OS type in field 12 */
pos2 = pos('_20_', srvrec.j, startpoint)
newdata = newdata || substr(srvrec.j, startpoint, (pos2+2)-startpoint)
newdata = newdata || '1'
startpoint = pos2 + 3
newdata = newdata || substr(srvrec.j, startpoint)
if substr(newdata, 1, 1) = ';' Then Do
ucnewdata = translate(newdata)
pos2 = pos('OS221', ucnewdata)
adaptype = substr(ucnewdata, pos2+5, 3)
/* if not 3COM entry, enable record */
If adaptype <> '3EI' & adaptype <> '3EM' Then newdata = substr(newdata, 2)
end
Call lineout rplmaptmp, newdata
end
end
end
end
end
end
end
end
end
else Do
pos2 = pos('1000FFFFFFFF', data)
if pos2 <> 0 Then Do
/* OS2 default workstation record, try to make sure fields 4 & 12 */
/* are valid */
field12 = word(data, 12)
pf12 = pos(field12, data)
os2type = substr(field12, 3, 2)
f12flag = 1
If os2type = '20' & os220 = 0 Then f12flag = 0
else If os2type = '2A' & os22a = 0 Then f12flag = 0
else If os2type = '21' & os221 = 0 Then fl12flag = 0
else If substr(os2type, 1, 1) = 'O' & os213 = 0 Then fl12flag = 0
If f12flag = 0 Then Do
/* field 12 is invalid, therefore so is field 4, update */
/* them so they are valid */
If os220 = 1 Then os2type = '20'
else If os22a = 1 Then os2type = '2A'
else If os221 = 1 Then os2type = '21'
else os2type = '21' /* default to 21 */
If os2type <> '' Then Do
field4 = word(data, 4)
pf4 = pos(field4, data)
pf4 = pf4 + length(field4) - 3
If os2type = '2A' Then newdata = substr(data, 1, pf4) || '20'
else newdata = substr(data, 1, pf4) || os2type
newdata = newdata || substr(data, pf4+3, pf12-pf4-1) || os2type
data = newdata || substr(data, pf12+4)
end
end
end
end
Call lineout rplmaptmp, data
end
Call lineout rplmap
Call lineout rplmaptmp
If os221flag = 0 Then Do
/* replace old RPL.MAP with new RPL.MAP */
rplmapxxx = 'RPLMAP.xxx'
Call Delete_File rpldir'\'rplmapxxx
'@rename 'rplmap rplmapxxx nulsufix
'@rename 'rplmaptmp 'RPL.MAP'nulsufix
Call Delete_File rpldir'\'rplmapxxx
end
else Call Delete_File rpldir'\'rplmaptmp
return
/* This subroutine creates CNF file for OS/2 2.1 */
Create_os221_cnf_files:
/* build list of possible source cnf filenames */
cnflist.0 = 5
cnflist.1 = 'os220tr'
cnflist.2 = 'os220et'
cnflist.3 = 'os220pc'
cnflist.4 = 'os2203ei'
cnflist.5 = 'os2203em'
Do i = 1 to cnflist.0
srccnffile = rpldir'\'cnflist.i'.cnf'
trgcnffile = rpldir'\'substr(cnflist.i,1,4)'1'substr(cnflist.i,6)'.cnf'
If File_Exist(srccnffile) = 1 Then Do
/* source file exists, check target file */
If File_Exist(trgcnffile) = 0 Then Do
/* file does not exist, create it */
do until lines(srccnffile) = 0
data = linein(srccnffile)
ucdata = translate(data)
pos2 = pos('OS2.20\', ucdata)
if pos2 <> 0 Then Do
/* update OS/2 directory reference */
newdata = substr(data, 1, pos2+4) || '1' || substr(data, pos2+6)
data = newdata
end
Call lineout trgcnffile, data
end
Call lineout srccnffile
Call lineout trgcnffile
end
end
end
return
/* Subroutine Update_Master_Configri_20 */
/* This subroutine creates new master CONFIGRI.20 files that have the */
/* DRIVER=x:\OS2\TESTCFG.SYS statement added to it */
Update_Master_Configri_20:
/* build list of directories in RPL\IBMCOM to process */
lanlist.0 = 6
lanlist.1 = 'TOKENRNG'
lanlist.2 = 'ETHERNET'
lanlist.3 = 'PCNETA'
lanlist.4 = 'PCNET'
lanlist.5 = 'ELNKII'
lanlist.6 = 'ELNKMC'
Do i = 1 to lanlist.0
lantype = lanlist.i
configfilename = rpldir'\IBMCOM\'lantype'\CONFIGRI.20'
If File_Exist(configfilename) <> 0 Then Do
/* build fully qualified path name for master CONFIGRI.20 */
configname = rpldir'\IBMCOM\'lantype'\CONFIGRI.20'
tmpconfigname = rpldir'\IBMCOM\'lantype'\CONFIGRI.20T'
bakconfigname = rpldir'\IBMCOM\'lantype'\CONFIGRI.20B'
/* Call SysFileDelete tmpconfigname */
Call Delete_File tmpconfigname
Call Delete_File bakconfigname
bootdrv = 'Z'
/* copy records looking for TESTCFG.SYS statement */
flag = 0
do until lines(configname) = 0
data = linein(configname)
ucdata = translate(data)
dpos = pos('SET PATH=', ucdata)
if dpos <> 0 Then Do
/* get bootdrive id from SET PATH statement */
dpos = pos(':\OS2;', ucdata)
if dpos <> 0 Then bootdrv = substr(ucdata, dpos-1, 1)
end
dpos = pos('DEVICE=', ucdata)
If dpos <> 0 Then Do
If pos('\OS2\TESTCFG.SYS', ucdata, dpos+7) <> 0 Then Do
/* DEVICE statement already present */
If word(ucdata, 1) = 'REM' Then Do
/* statement REMed out, un-REM it */
newdata = substr(data, dpos)
data = newdata
end
flag = 1
end
end
Call lineout tmpconfigname, data
end
If flag = 0 Then Do
/* add DEVICE statement to end of file */
Call lineout tmpconfigname, 'DEVICE='bootdrv':\OS2\TESTCFG.SYS'
end
Call Lineout tmpconfigname /* close file */
Call Lineout configname /* close file */
/* rename original CONFIGRI.20 */
'@rename 'configname' CONFIGRI.20B'
if rc = 0 Then Do
/* rename CONFIGRI.20T to be CONFIGRI.20 */
'@rename 'tmpconfigname' CONFIGRI.20'
if rc = 0 Then Do
/* delete orginal CONFIGRI.20 */
Call Delete_File bakconfigname
end
else Do
/* rename error, try to restore original */
'@rename 'bakconfigname' CONFIGRI.20'
end
end
end
end
return 0
Determine_Boot_Drive:
/* find the boot driver id */
os2path = value('PATH',,'OS2ENVIRONMENT')
os2p = pos(':\OS2', translate(os2path))
if os2p = 0 Then Do
msgdata = errprefix || message.5
Call Display_Log_Msg msgdata, ''
return 4
end
bootdrv = substr(os2path, os2p-1, 1)
return 0
Determine_RIPL_Directory:
/* find out where IBMLAN is installed */
os2path = value('PATH',,'OS2ENVIRONMENT')
ibmlanp = pos(':\IBMLAN', translate(os2path))
if ibmlanp = 0 Then Do
msgdata = errprefix || message.6
Call Display_Log_Msg msgdata, ''
return 4
end
landrv = substr(os2path, ibmlanp-1, 1)
lanpath = landrv':\IBMLAN'
fname = lanpath'\IBMLAN.INI'
/* read IBMLAN.INI looking for the RPLDIR entry */
do until lines(fname) = 0
data = translate(linein(fname))
rpldirp = pos('RPLDIR', data)
if rpldirp <> 0 then do
rpldirp = pos('=', data)
rpldir = strip(substr(data, rpldirp+1))
Leave
end
end
Call stream fname,C,'close'
if rpldir = '' then do
msgdata = errprefix || message.13
Call Display_Log_Msg msgdata, ''
return 4
end
return 0
/* Process command line parameters */
Process_Input_Parameters:
Arg parm.1, parm.2, parm.3
Do i = 1 to 3
If parm.i = '' Then Leave
parmtype = substr(parm.i,1,2)
select
when parmtype = '?' Then Call Syntax_Help
when parmtype = '/H' Then Call Syntax_Help
when parmtype = '/L' Then Do
/* Logfile parameter */
if substr(parm.i, 3, 1) = ':' Then Logfile = substr(parm.i, 4)
else Logfile = substr(parm.i, 3)
end
when parmtype = '/S' Then Do
/* Sourcepath parameter */
if substr(parm.i, 3, 1) = ':' Then SourcePath = substr(parm.i, 4)
else SourcePath = substr(parm.i, 3)
If substr(SourcePath, length(SourcePath), 1) <> '\' Then Do
/* insure path ends in a \ */
SourcePath = SourcePath || '\'
end
end
otherwise Do
msgdata = errprefix || message.4
Call Display_Log_Msg msgdata, parm.i
return 4
end
end
end
return 0
Syntax_Help:
do i = 30 to 33
Call Display_Log_Msg message.i, ''
end
exit
Initialize_NLS_Messages:
/***********************************************************************/
/* NLS messages */
/* */
/* The following message strings should be translated for NLS support. */
/* */
/* Note: The %1, %2, etc. strings represent dynamic data fields that */
/* are filled in when the message is displayed. Do not */
/* translate the %1, %2, etc. fields. */
/* The 'CRLF,' sequence that ends some lines represents */
/* formatting control (new line) and should not be translated. */
/* However, after translation, each message may need to be */
/* manually reformatted to prevent excessive length message */
/* lines. The message display code does not automatically */
/* reformat long message lines. */
/***********************************************************************/
arg message_type
/* error message prefix */
errprefix = 'ERROR: '
/* start of error messages */
message.1 = 'Missing keyword in '
message.2 = 'HISTORY LOG: '
message.3 = 'Unable to open the Logfile '
message.4 = 'The option %1 is not a valid option.'
message.5 = 'Unable to determine the boot driver id.'
message.6 = 'Unable to determine where LAN Server is installed.'
message.7 = 'Unable to determine the server name.'
message.8 = 'DEFALT21.FIT was not updated.'
message.9 = 'Error copying %1 to %2.'
message.10 = 'PKUNZIP2 Error while installing %1 to %2.'
message.11 = 'The level of LAN Server installed is %1. This level of' CRLF,
' LAN Server can not be updated to support OS/2 2.1.'
message.12 = 'The level of LAN Server installed is %1. This level of' CRLF,
' LAN Server does not need to be upgraded.'
message.13 = 'The RPLDIR parameter was not found in IBMLAN.INI.'
/* start of informational messages */
message.15 = 'RPL.MAP was updated to support OS/2 2.1.'
message.16 = 'OS221*.CNF files were created.'
message.17 = 'DEFALT21.FIT was updated.'
message.18 = 'Copying %1 to %2.'
message.19 = 'Installing %1 to %2.'
message.20 = 'Creating new Remote IPL subdirectories.'
message.21 = 'Master CONFIGRI.20 files were updated.'
/* start of syntax help messages */
message.30 = 'RPLMIG21.CMD [ ? | /h | /H] [/S:Sourcepath] [/L:Logfile]'CRLF
message.31 = ' where ? or /h or /H is a request for this help panel. If specified, it' CRLF,
' must be first parameter.'CRLF
message.32 = ' /S:Sourcepath is the fully qualified path to the root directory' CRLF,
' which contains the files to be installed by RPLMIG21. The' CRLF,
' default value is A:\.' CRLF
message.33 = ' /L:Logfile is the fully qualified name of a file to which all' CRLF,
' messages and errors are to be logged. If Logfile is specified,' CRLF,
' no messages or errors will be displayed on the screen.'
return